<template>
  <el-table :data="tableData" border stripe style="width: 100%">
    <el-table-column prop="authName" label="权限名" width="520">
    </el-table-column>
    <el-table-column prop="path" label="权限路径" width="520"> </el-table-column>
    <el-table-column
      prop="level"
      label="权限等级"
      width="520"
      :filter-method="filterTag"
      filter-placement="bottom-end"
    >
      <template slot-scope="scope">
        <el-tag
          :type="
            scope.row.level === '一级'
              ? 'primary'
              : scope.row.level === '二级'
              ? 'success'
              : 'warning'
          "
          disable-transitions
          >{{ scope.row.level }}</el-tag
        >
      </template>
    </el-table-column>
  </el-table>
</template>
<script>
export default {
  data() {
    return {
      tableData: [{}],
    };
  },
  async created() {
    let ras = await this.$http.getAuthor();
    console.log(ras.data.data);
    this.tableData = ras.data.data;
    this.tableData.forEach((item) => {
      if (item.level == 0) {
        item.level = "一级";
      } else if (item.level == 1) {
        item.level = "二级";
      } else if (item.level == 2) {
        item.level = "三级";
      }
    });
  },
};
</script>